#pragma once

#define COUNT_ARGS_IMPL(_100, _99, _98, _97, _96, _95, _94, _93, _92, _91, _90, _89, _88, _87, _86, _85, _84, _83, _82, _81, _80, _79, _78, _77, _76, _75, _74, _73, _72, _71, _70, _69, _68, _67, _66, _65, _64, _63, _62, _61, _60, _59, _58, _57, _56, _55, _54, _53, _52, _51, _50, _49, _48, _47, _46, _45, _44, _43, _42, _41, _40, _39, _38, _37, _36, _35, _34, _33, _32, _31, _30, _29, _28, _27, _26, _25, _24, _23, _22, _21, _20, _19, _18, _17, _16, _15, _14, _13, _12, _11, _10, _9, _8, _7, _6, _5, _4, _3, _2, _1, n, ...) n
/**
  * @brief  获取参数的个数
  * @note   支持最大100个参数
  * @param  编译器支持的参数
  * @retval 参数的个数
  */
#define COUNT_ARGS(...) COUNT_ARGS_IMPL(__VA_ARGS__,100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1)

#define CONCAT_2(x, y) x##y
/**
  * @brief  将两段宏进行拼接
  * @note   保证宏拼接后继续进行宏展开
  * @param  两个宏
  * @retval 拼接后的结果
  */
#define CONCAT(x, y) CONCAT_2(x,y)

/**
  * @brief  宏参数强制计算
  * @note   保证宏做做参数必须被展开计算
  */
#define CALL(x) x
